<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport"
			content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../../css/mui.min.css" rel="stylesheet" />
		<!--<link rel="stylesheet" href="../../css/allApp.css" />-->
		<!-- <link rel="stylesheet" href="../css/css.css" /> -->
		<style type="text/css">
			body,
			.mui-content {
				background-color: #FFFFFF;
			}

			.mui-bar .mui-title {
				right: 80px;
				left: 80px;
			}

			.yxj-row {
				width: 92%;
				margin-left: 4%;
				padding: 10px;
				border-bottom: 1px solid #eaeaea;
			}

			.marbtm {
				margin-bottom: 3px;
			}

			.colorA3A3A3 {
				color: #A3A3A3;
			}

			.color1A5186 {
				color: #1A5186;
			}

			.flex {
				display: flex;
			}

			.justcnt {
				justify-content: space-between;
			}

			.fontsize13 {
				font-size: 13px;
			}

			.fontsize15 {
				font-size: 15px;
			}

			.dsh-btn {
				color: #ffffff;
				background-color: #1A5186;
				border-radius: 3px;
				padding: 2px 20px;
				font-size: 13px;
			}

			.wifi {
				width: 80%;
				margin: 100px auto;
				text-align: center;
			}

			.wifi img {
				width: 80%;
				margin-right: 20px;
			}

			.wifi p {
				font-size: 1rem;
			}

			[v-cloak] {
				display: none;
			}

			.wifi {
				width: 80%;
				margin: 100px auto;
				text-align: center;
			}

			.wifi img {
				width: 80%;
				margin-right: 20px;
			}

			.wifi p {
				font-size: 1rem;
			}

			
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title" >待审核</h1>
		</header>
		<div class="mui-content" id="container" v-cloak>
			<div class="mui-row yxj-row" v-for="(ie,ix) in list" :key="ix"  @click="detail(ie)">
				<div class="marbtm fontsize15 flex justcnt">
					<span >{{ie.name | ellipsis(16)}}</span>
					<span class="dsh-btn" >审核</span>
				</div>
				<div  class="colorA3A3A3 fontsize13">开始时间：{{ie.start_time}}</div>
				<div  class="colorA3A3A3 flex justcnt fontsize13">
					<span>结束时间：{{ie.end_time}}</span>
					<span class="color1A5186">耗时{{ie.cost}}</span>
				</div>
			</div>
			<div class="wifi" v-if="ifshow"><img src="./../img/empty_data.png" />
				<p>亲，这里没有数据了哦~</p>
			</div>


		</div>
		<script src="../../../js/mui.min.js"></script>
		<script type="text/javascript" src="../../../js/mkeyplus.base.xunjian.js"></script>
		<script type="text/javascript" src="../../../js/vue.js"></script>
		<script type="text/javascript" src="../../../js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript">
			mui.init({
				pullRefresh: {
					container: '#container',
					down: {
						style: 'circle',
						callback: function() {
							if (vm) {
								vm.pulldownRefresh()
							}
						}
					}
				}
			})
			
			mui.plusReady(function() {
				vm.getList();
			})
			
			
			window.addEventListener('refresh', function(e){//执行刷新
				vm.getList();
			});



			window.vm = new Vue({
				el: "#container",
				data: {
					org_code: JSON.parse(localStorage.getItem('org_code')),
					memberId: localStorage.getItem('userid'),
					list: [],
					item:'',
					flag:false,
					ifshow:false
				},
				filters: {
					ellipsis(value, num) {
						if (!value) return ''
						if (value.length > num) {
							return value.slice(0, num) + '...'
						}
						return value
					}
				},
				methods: {
					pulldownRefresh() {
						/** 下来加载
						 * @method pulldownRefresh
						 * @param {空} 
						 * @return {空} 
						 */
						this.getList()
						setTimeout(function() {
							mui('#container').pullRefresh().endPulldownToRefresh();
						}, 1000);
					},
					detail(item) {
						/** 巡检设备
						 * @method detail
						 * @param {item} 
						 * @return {空} 
						 */
						if(item.type == 1){
							var sbid = item.id;
							var title = item.name.substring(5);
							mui.openWindow({
								url: 'dshlistchild.html',
								id: 'dshlistchild.html',
								extras: {
									sbid: sbid,
									title: title,
									item:item,
									from:'dsh'
								},
								createNew: false, //是否重复创建同样id的webview，默认为false:不重复创建，直接显示
							})
						}else if(item.type == 2){
							var id = item.id;
							mui.openWindow({
								url: 'yulan.html',
								id: 'yulan.html',
								extras: {
									_id: id,
									Type: '',
									item:item,
									from:'dsh'
								},
								createNew: false
							})
						}
					},
					getList() {
						/** 获取待审核列表数据
						 * @method getList
						 * @param {空}
						 * @return {空} 
						 */
						var that = this
						//plus.nativeUI.showWaiting('加载中');
						mui.baseApp.httpRequst('/api/v2/sbxj/findXsdWindList', {
								wind: that.org_code,
								status: '3',
								memberId: that.memberId
							},
							function(res) {
								if(res.status != 200){
									mui.toast(res.message);
									return;
								}
								that.ifshow = false;
								//plus.nativeUI.closeWaiting();
								if(res.data.length == 0){
									that.ifshow = true;
								}
								that.$set(vm.$data, 'list', res.data)
								console.log(JSON.stringify(res.data))
							},
							function(err) {
								console.log(JSON.stringify(err))
							}
						);
					}
				}
			})
			/* end vm code */
			
			mui.back = function() {
				var _self = plus.webview.currentWebview();
				var page1 = plus.webview.getWebviewById('../jiankong/jiankong.html');
				mui.fire(page1, 'refresh');
				_self.close("auto");
			}
		</script>
	</body>

</html>
